import { Component, OnInit } from '@angular/core';
import { HttpService } from '../http.service';
import * as ons from 'onsenui';



@Component({
  selector: 'app-service',
  templateUrl: './service.component.html',
  styleUrls: ['./service.component.less']
})
export class ServiceComponent implements OnInit {
  name:string='';
  tel='';
  content='';
  uploading:Boolean = false;

  constructor(private http: HttpService) {
   }

  ngOnInit() {
  }

  async save(){
    if(!this.name || !this.tel || !this.content) {
      ons.notification.toast('表格信息需填写完整!', {timeout: 2000});
      return;
    }
    if(this.uploading) return;
    this.uploading = true;
    await this.http.post({
      name: 'car.sys.feedback',
      user_name: this.name,
      connect_mobile: this.tel,
      description: this.content
    })
    this.uploading = false;
    this.name = this.tel = this.content = '';
    ons.notification.toast('反馈成功!', {timeout: 2000});
  };

}
